import ollama
import json

try:
    response = ollama.chat(model='llama3.2', messages=[
        {
            'role': 'user',
            'content': '天空为什么是蓝色的',
        },
    ])
    print(response['message']['content'])
except ollama.ResponseError as e:
    print(f"API Error: {e.__dict__}")
except Exception as e:
    print(f"An unexpected error occurred: {e}")